#ifndef TUIMGR_H
#define TUIMGR_H

#include "../../include/ituimgr.h"

struct TTmUI
{
    QString         name;
    unsigned long   lUiId;
    long            lLoadOrder;
    long            lUnloadOrder;
    QString         strDllPath;
    void            *pMgr;
    QLibrary        *pDll;
};

typedef std::list<TTmUI*> TTmUIList;

struct TTmUiModel
{
    TTmUiModel() {memset(this,0,sizeof(TTmUiModel));}
    long        lUiId;
    ITModelBase *pModel;
};

typedef std::map<unsigned long, TTmUiModel*> TTmUiModelMap;

class ITLogger;
class TUiMgr : public ITUiMgr
{
public:
    static TUiMgr* GetInstance() {static TUiMgr __instance; return &__instance;}
public:
    virtual TRESULT Init();
    virtual TRESULT UnInit();
    virtual TRESULT SetFramework(ITFramework *pFrm);
    virtual TRESULT GetUiFromId(unsigned long lUiId, ITModelBase **ppModel);
    virtual TRESULT Find(unsigned long lUiId, ITModelBase **ppModel);
public:
    TUiMgr();
    virtual ~TUiMgr();
private:
    ITFramework     *m_pFramework;
    TTmUIList       m_pUIList;
    TTmUiModelMap   m_pModelMap;
    QString         m_szLog;
    ITLogger        *m_pLogger;
};


#endif // TUIMGR_H
